#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    void rotate(vector<int>& nums, int k) 
    {
        int n = nums.size();
        vector<int> newArr(n);
        for (int i = 0; i < n; ++i) 
        {
            newArr[(i + k) % n] = nums[i];
        }
        nums.assign(newArr.begin(), newArr.end());
    }
};

int main()
{
    vector<int> nums = { 1, 2, 3, 4, 5, 6, 7 };
    int k = 3;

    Solution xz;
    xz.rotate(nums, k);

    for (auto e : nums)
    {
        cout << e << ' ';
    }

	return 0;
}